package com.billiards.config;


//跨域文件
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
//                后端接受前端的域
                .allowedOrigins("http://localhost:8080")
                .allowCredentials(true)
                .allowedMethods("GET","POST","PUT","DELETE","OPTIONS");
        WebMvcConfigurer.super.addCorsMappings(registry);
    }
}
